package com.nut.service.shopcart;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.nut.dao.ShopcartMapper;
import com.nut.pojo.Shopcart;
import com.nut.pojo.ShopcartExample;
import com.nut.pojo.Sku;

/**
*@author Nut
*@version 2018年8月17日 下午2:14:01
*@TODO
*
*/
@Service
public class ShopcartServiceImpl implements ShopcartServiceI {

	@Resource
	ShopcartMapper scm;
	
	@Override
	public int add(Shopcart shopcart) {
		
		return scm.insertSelective(shopcart);
	}
	@Override
	public List<Shopcart> querySkusByUserId(int userId) {
		
		ShopcartExample example = new ShopcartExample();
		example.createCriteria().andUserIdEqualTo(userId);
		
		return scm.selectByExample(example);
	}
	@Override
	public int updateOne(Shopcart shopcart) {
		
		return scm.updateByPrimaryKey(shopcart);
	}
	@Override
	public Shopcart queryOne(int id) {
		
		return scm.selectByPrimaryKey(id);
	}
	@Override
	public int delete(int id) {
		
		return scm.deleteByPrimaryKey(id);
	}

}
